package com.gravata.enigma.model;

import java.io.Serializable;

import com.j256.ormlite.dao.ForeignCollection;
import com.j256.ormlite.field.DataType;
import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.field.ForeignCollectionField;
import com.j256.ormlite.table.DatabaseTable;

@DatabaseTable(tableName="profile")
public class Profile extends EntidadeAbstrata {

	private static final long serialVersionUID = -1235166687335587979L;

	public Profile() {
		// TODO Auto-generated constructor stub
	}

	@DatabaseField(generatedId=true)
	private int id;

	@DatabaseField(canBeNull=false,columnName="nome")
	private String nome;

	@DatabaseField(canBeNull=false,columnName="usuario")
	private String usuario;
	@DatabaseField(canBeNull=false,columnName="senha")
	private String senha;
	@DatabaseField(canBeNull=false,columnName="porta")
	private int porta;

	@DatabaseField(canBeNull=false,columnName="porta_http")
	private int portaHttp;

	@DatabaseField(canBeNull=false,columnName="url")
	private String url;
	@DatabaseField(canBeNull=false,columnName="lamepath")
	private String lamePath;
	@DatabaseField(canBeNull=false,columnName="satelitepath")
	private String satelitePath;

	@DatabaseField(canBeNull=true,columnName="selecionado",dataType=DataType.BOOLEAN)
	private boolean selecionado;

	@ForeignCollectionField(eager=false)
	private ForeignCollection<Bouquet> bouquets;

	@ForeignCollectionField(eager=false)
	private ForeignCollection<Regra> regras;

	@ForeignCollectionField(eager=false)
	private ForeignCollection<Service> services;

	@ForeignCollectionField(eager=false)
	private ForeignCollection<Satelite> satelites;

	public Serializable getId() {
		return id;
	}

	public String getNome() {
		return nome;
	}
	public void setNome(String nome) {
		this.nome = nome;
	}

	public String getUsuario() {
		return usuario;
	}
	public void setUsuario(String usuario) {
		this.usuario = usuario;
	}
	public String getSenha() {
		return senha;
	}
	public void setSenha(String senha) {
		this.senha = senha;
	}
	public int getPorta() {
		return porta;
	}
	public void setPorta(int porta) {
		this.porta = porta;
	}
	public String getUrl() {
		return url;
	}
	public void setUrl(String url) {
		this.url = url;
	}
	public String getLamePath() {
		return lamePath;
	}
	public void setLamePath(String lamePath) {
		this.lamePath = lamePath;
	}
	public String getSatelitePath() {
		return satelitePath;
	}
	public void setSatelitePath(String satelitePath) {
		this.satelitePath = satelitePath;
	}
	public void setSelecionado(boolean selecionado) {
		this.selecionado = selecionado;
	}
	public boolean isSelecionado() {
		return selecionado;
	}

	public int getPortaHttp() {
		return portaHttp;
	}
	public void setPortaHttp(int portaHttp) {
		this.portaHttp = portaHttp;
	}

	public ForeignCollection<Bouquet> getBouquets() {
		return bouquets;
	}
	public ForeignCollection<Service> getServices() {
		return services;
	}
	public ForeignCollection<Regra> getRegras() {
		return regras;
	}

	public ForeignCollection<Satelite> getSatelites() {
		return satelites;
	}
	public String getUrlCompleta(){
		String tmp="";
		if(!url.startsWith("http"))
			tmp="http://";
		tmp+=url+":"+portaHttp;
		return tmp;
	}
}
